﻿@model IEnumerable<Tecnosop.WebUI.Models.ItemViewModel>
@{
    ViewBag.Title = "Ver todos los ítems";
    Layout = "~/Views/Item/_LayoutItem.cshtml";
}
<fieldset>
<legend>Lista de ítems</legend>
    <br />
    @(Html.Telerik().Grid(Model)
        .Name("Items")
        .DataKeys(keys => keys.Add(k => k.CODIGO_ITEM))
        .DataBinding(dataBinding => dataBinding.Server()
            .Delete(MVC.Item.Delete().GetRouteValueDictionary()))
        .Columns(columuns =>
            {
                columuns.Bound(c => c.CODIGO_ITEM)
                    .Aggregate(ag => ag.Count())
                    .Format(Html.ActionLink("{0}", MVC.Item.ActionNames.Details, new { id = "{0}" }).ToString())
                    .Encoded(false)
                    .Width(150)
                    .Groupable(false);
                columuns.Bound(c => c.MARCA);
                columuns.Bound(c => c.MODELO);
                columuns.Bound(c => c.PRECIO);
                columuns.Bound(c => c.Tipo);
                @*columuns.Template(
                    @<text>
                        @Html.ActionLink("Editar", MVC.Insumo.Edit(item.CODIGO_ITEM), new { @class = "nice radius thin white button" })
                    </text>).Width(60);*@
                columuns.Command(cmd =>
                    {
                        cmd.Custom("Editar")
                                .Text("Editar")
                                .Ajax(false)
                                .ButtonType(GridButtonType.ImageAndText)
                                .ImageHtmlAttributes(new { @class = "t-icon t-edit" })
                                .HtmlAttributes(new { @class = "nice radius verysmall white button" })
                                .Action(MVC.Item.ActionNames.Edit, MVC.Item.Name);
                        cmd.Delete()
                            .ButtonType(GridButtonType.ImageAndText)
                            .HtmlAttributes(new { @class = "nice radius verysmall red button" });
                    }).Width(170);
            })
        .Selectable()
        .Pageable(paging => paging.PageSize(10))
        .Scrollable(scrolling => scrolling.Enabled(false))
        .PrefixUrlParameters(false)
        .Sortable()
        .Filterable()
        .Groupable()
        )
</fieldset>